#pragma once
#include"log.hpp"
#define PATHNAME "/home/hqy"
#define PROJ_id 888
#define SHMSIZE 4096
key_t Getkey()
{
    key_t key = ftok(PATHNAME,PROJ_id);
    return key;
}
int _CreatShm(int flags)
{
    int key = Getkey();
    int shmid = shmget(key,  SHMSIZE,flags);
    return shmid;
}
int Creatshm()
{
    return _CreatShm(IPC_CREAT|IPC_EXCL|0666);//给processa进程创建并获取shmid
}
int Getshm()
{
    return _CreatShm(IPC_CREAT);//给另一个进程获取共享内存
}
